/**
 *
 */
package com.dianning.comm;

import java.io.InputStream;
import java.util.*;

/**
 * @author laoer
 *
 */
public class Constant {

	public static final boolean USE_CACHE = true;
	
	public static final String VSERION = "2.0";

	public static final String CHARSET = "UTF-8";
	
	public static String SERVLET_MAPPING = "*.action";

	public static String ROOTPATH = "";

	public static final String USER_SESSION_KEY = "user_session";
	
	public static final String COOKIE_AUTOLOGIN_AUTH = "autologin_auth";

	public static final int ORDER_ASC = 0;

	public static final int ORDER_DESC = 1;
	
	public static String DOMAIN = "";
	
	public static String PROFILE_DOMAIN = "";
	
	public static String DEFAULT_AVATAR_PATH = "/images/avatar.jpg";
	
	public static String AVATAR_PATH = "";
	
	public static String LICENSE_PATH = "";
	
	public static String IDCARD_PATH = "";
	
	public static String INFO_AVATAR_PATH = "";
	
	public static String INFO_PIC_PATH = "";
	
	public static String AREA_NAME = "";

	public static int INIT_MONEY = 0;
	
	public static int REFRESH_MONEY = 0;
	
	public static int RATE_MONEY = 0;
	
	public static int INVITE_MONEY = 0;
	
	public static int OPEN_PROFILE_MONEY = 0;
	
	public static int VISITOR_20IP_MONEY = 0;
	
	public static int VISITOR_50IP_MONEY = 0;
	
	public static int PROFILE_STATUS = 0;
	
	public static int INFO_CREDIT_NUMBER = 0;
	
	public static int MONEY_CREDIT_NUMBER = 0;
	
	public static final int PAGE_NUM = 35;
	
	public static final int PROFILE_PAGE_NUM = 15;
	
	public static final int USER_PAGE_NUM = 20;
	
	public static HashMap<String, String> POP_MAP = new HashMap<String, String>();
	
	private static  Properties properties;
	static {
		properties = new Properties();
        try {
        	Class config_class = Class.forName(Constant.class.getName());
            InputStream is = config_class.getResourceAsStream("/init.properties");
            properties.load(is);
            DOMAIN = properties.getProperty("domain");
            PROFILE_DOMAIN = properties.getProperty("profile.domain");
            AVATAR_PATH = properties.getProperty("avatar.path");
            LICENSE_PATH = properties.getProperty("license.path");
            IDCARD_PATH = properties.getProperty("idcard.path");
            INFO_AVATAR_PATH = properties.getProperty("info.avatar.path");
            INFO_PIC_PATH = properties.getProperty("info.pic.path");
            AREA_NAME = properties.getProperty("area.name");
            INIT_MONEY = Integer.parseInt(properties.getProperty("init_money"));
            REFRESH_MONEY = Integer.parseInt(properties.getProperty("refresh_money"));
            RATE_MONEY = Integer.parseInt(properties.getProperty("rate_money"));
            INVITE_MONEY = Integer.parseInt(properties.getProperty("invite_money"));
            OPEN_PROFILE_MONEY = Integer.parseInt(properties.getProperty("open_profile_money"));
            VISITOR_20IP_MONEY = Integer.parseInt(properties.getProperty("visitor_20ip_money"));
            VISITOR_50IP_MONEY = Integer.parseInt(properties.getProperty("visitor_50ip_money"));
            PROFILE_STATUS = Integer.parseInt(properties.getProperty("profile_status"));
            INFO_CREDIT_NUMBER = Integer.parseInt(properties.getProperty("info_credit_number"));
            MONEY_CREDIT_NUMBER = Integer.parseInt(properties.getProperty("money_credit_number")); 
            
            POP_MAP.put("/user/message.action?action=add", "sendMessage");
            POP_MAP.put("/user/report.action?action=add", "report");
            POP_MAP.put("/user/report.action?action=profile", "reportProfile");
        } catch (Exception e) {
            e.printStackTrace();
        }
	}

}
